using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace WindowsGame1
{
    /// <summary>
    /// This is the main type for your game
    /// </summary>
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        public static Game1 Self;

        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;

        Objeto3D objeto, objeto2;
        Camera3D camera;
        

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            Self = this;
        }


        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            objeto = new Objeto3D(Content.Load<Model>("personagem"));
            objeto2 = new Objeto3D(Content.Load<Model>("personagem"));
            objeto2.position.X = -1;
            camera = new Camera3D();
            //camera.lookAt.X = 5;
            

            

        }




        protected override void Update(GameTime gameTime)
        {
            //objeto.position.X = 8f;
            objeto2.position.X = -8f;
            objeto.rotation.Y += 0.1f;

            if (Keyboard.GetState().IsKeyDown(Keys.Up))
            {
                objeto.position.Z -= 0.1f;
            }

            if (objeto.hitTestObject(objeto2))
            {
                objeto2.scale.X -= 0.1f;
            }

            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            objeto.Draw(camera);
            objeto2.Draw(camera);
            
            base.Draw(gameTime);
        }
    }
}
